package cn.school.mybatis.dao;

import java.util.*;

import org.apache.ibatis.session.SqlSession;

import cn.school.mybatis.pojo.Student;
import cn.school.mybatis.util.MyBatisUtil;

public class StudentDaoTest {

	public static void main(String[] args) {
		// 测试
		// testSearch();
		testSearch0();
	}

	public static void testSearch() {
		SqlSession session = MyBatisUtil.get();
		StudentDao dao = session.getMapper(StudentDao.class);
		List<Student> list = dao.search("李", "151");
		MyBatisUtil.close(session);
		for (Student s : list)
			System.out.println(s);
	}

	public static void testSearch0() {
		SqlSession session = MyBatisUtil.get();
		StudentDao dao = session.getMapper(StudentDao.class);
		Map<String, Object> map = new HashMap<>();
		map.put("sname", "李");
		map.put("telephone", "18");
		map.put("gradeid", 3L);
		map.put("address", "阜阳");
		List<Student> list = dao.search0(map);
		MyBatisUtil.close(session);
		for (Student s : list)
			System.out.println(s);
	}

}
